import http from './config.js'
import baseUrl from './baseUrl.js'
export const service = {
    testGet: (params = {}) => {
        return http.get(baseUrl.testUrl + '/article/download/blob', params)
    },
    testPost: (params = {}) => {
        return http.post(baseUrl.testUrl + '/article', params, {
            responseType: 'json'
        })
    },
    testPostForm: (params = {}) => {
        return http.postForm(baseUrl.testUrl + '/article', params, {
            cancel: true
        })
    },
    testPut: (params = {}) => {
        return http.put(baseUrl.testUrl + '/article', params)
    },
    testPutForm: (params = {}) => {
        return http.putForm(baseUrl.testUrl + '/article', params)
    },
    testDelete: (params = {}) => {
        return http.delete(baseUrl.testUrl + '/article', params)
    },
    GetDownload: (params = {}) => {
        return http.GetDownload(baseUrl.testUrl + '/article/download/blob', params)
    },
    registerService: (params = {}) => {
        return http.post(baseUrl.testUrl + '/user/register', params)
    },
    loginService: (params = {}) => {
        return http.post(baseUrl.testUrl + '/user/login', params)
    },
    // 统一认证
    loginCertService: (params = {}) => {
        return http.post(baseUrl.testUrl + '/user/loginCert', params)
    },
    // 获取手机验证码
    getSmsCode: (params = {}) => {
        return http.get(baseUrl.testUrl + `/user/sms`, params)
    },
    
    // 项目部分 ===》
    // 添加项目
    addProject: (params = {}) => {
        return http.post(baseUrl.testUrl + '/project', params)
    },
    // 编辑项目
    putProject: (params = {}) => {
        return http.put(baseUrl.testUrl + '/project', params)
    },
    // 删除项目
    delProject: (params = {}) => {
        return http.delete(baseUrl.testUrl + '/project', params)
    },
    // 获取项目列表
    getProject: (params = {}) => {
        return http.get(baseUrl.testUrl + '/project', params)
    },
    
    // 用户部分 ===》
    // 搜索用户
    searchUser: (params = {}) => {
        return http.get(baseUrl.testUrl + '/user/searchUser', params)
    },
    // 获取全部用户
    allUser: (params = {}) => {
        return http.get(baseUrl.testUrl + '/user/allUser', params)
    },
    // 修改用户
    putUser: (params = {}) => {
        return http.put(baseUrl.testUrl + '/user/allUser', params)
    },
    // 添加用户
    addUser: (params = {}) => {
        return http.post(baseUrl.testUrl + '/user/allUser', params)
    },
    // 刪除用户
    delUser: (params = {}) => {
        return http.delete(baseUrl.testUrl + '/user/allUser', params)
    },
    
    // 授权部分 ===》
    // 授予用户项目权限
    setRightToUser: (params = {}) => {
        return http.post(baseUrl.testUrl + '/projectUser', params)
    },
    // 根据项目id获取用户列表
    getUserListByAppid: (params = {}) => {
        return http.get(baseUrl.testUrl + '/projectUser', params)
    },
    // 修改用户项目权限
    editUserRight: (params = {}) => {
        return http.put(baseUrl.testUrl + '/projectUser', params)
    },
    // 撤销用户项目权限
    delUserRight: (params = {}) => {
        return http.delete(baseUrl.testUrl + '/projectUser', params)
    },
    // 获取用户拥有管理权限的项目列表
    getProjectIsManage: (params = {}) => {
        return http.get(baseUrl.testUrl + '/projectUser/getProjectIsManage', params)
    },
}
